home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 4.4 KB | 154 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWTxtShp.h
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWTXTSHP_H
- #define FWTXTSHP_H
-
- #ifndef FWBTXTSH_H
- #include "FWBTxtSh.h"
- #endif
-
- #ifndef FWGCONST_H
- #include "FWGConst.h"
- #endif
-
- //========================================================================================
- // class FW_CTextShape
- //========================================================================================
-
- class FW_CTextShape : public FW_CBaseTextShape
- {
- public:
- FW_DECLARE_CLASS
- FW_DECLARE_AUTO(FW_CTextShape)
-
- //----------------------------------------------------------------------------------------
- // Constructors/Destructors
- //
- public:
-
- enum
- {
- kDefaultAlignment =
- FW_kTextAlignLeft |
- FW_kTextAlignTop |
- FW_kTextAlignUseSpecifiedPos
- };
-
- FW_CTextShape();
- FW_CTextShape(const FW_CString& string,
- FW_Fixed xPos,
- FW_Fixed yPos,
- const FW_CFont& font = FW_kNormalFont,
- FW_TextAlignment textAlignment = kDefaultAlignment,
- const FW_CInk& ink = FW_kNormalTextInk);
-
- FW_CTextShape(FW_CTextReader& textReader,
- FW_Fixed xPos,
- FW_Fixed yPos,
- const FW_CFont& font = FW_kNormalFont,
- FW_TextAlignment textAlignment = kDefaultAlignment,
- const FW_CInk& ink = FW_kNormalTextInk);
-
- FW_CTextShape(const FW_CTextShape& other);
- FW_CTextShape(FW_CReadableStream& stream);
-
- virtual ~ FW_CTextShape();
-
- //----------------------------------------------------------------------------------------
- // Operators
- //
- public:
- FW_CTextShape& operator=(const FW_CTextShape& other);
-
- //----------------------------------------------------------------------------------------
- // Inherited API
- //
- public:
- // ----- Rendering -----
- virtual void Render(FW_CGraphicContext& gc) const;
-
- // ----- Transform -----
- virtual void Transform(Environment* ev, ODTransform* odTransform);
- virtual void InverseTransform(Environment* ev, ODTransform* odTransform);
-
- virtual void MoveShape(FW_Fixed deltaX, FW_Fixed deltaY);
- virtual void MoveShapeTo(FW_Fixed x, FW_Fixed y);
-
- virtual void Inset(FW_Fixed x, FW_Fixed y);
-
- // ----- Copying -----
- virtual FW_CShape* Copy() const;
-
- // ----- Geometry -----
- virtual void GetBounds(FW_CGraphicContext& gc, FW_CRect& rect) const;
-
- // ----- Anchor Point -----
- virtual FW_CPoint GetAnchorPoint() const;
-
- // ----- Flatten -----
- virtual void Flatten(FW_CWritableStream& stream) const;
-
- //----------------------------------------------------------------------------------------
- // New API
- //
- public:
- // ----- Rendering -----
- static void RenderText(FW_CGraphicContext& gc,
- FW_CTextReader& textReader,
- const FW_CPoint& position,
- const FW_CFont& font,
- FW_TextAlignment textAlignment = kDefaultAlignment,
- const FW_CInk& ink = FW_kNormalTextInk);
-
- static void RenderText(FW_CGraphicContext& gc,
- const FW_CString& string,
- const FW_CPoint& position,
- const FW_CFont& font,
- FW_TextAlignment textAlignment = kDefaultAlignment,
- const FW_CInk& ink = FW_kNormalTextInk);
-
- // ----- Measurement -----
- FW_CPoint CalcExtent(FW_CGraphicContext& gc) const;
-
- static FW_CPoint CalcTextExtent(FW_CGraphicContext& gc,
- FW_CTextReader& textReader,
- const FW_CFont& font);
- static FW_CPoint CalcTextExtent(FW_CGraphicContext& gc,
- const FW_CString& string,
- const FW_CFont& font);
-
- // ----- Archiving -----
- static void* Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
-
- // ----- Geometry -----
- FW_CPoint GetPosition() const
- {return fPosition;}
-
- void SetPosition(FW_Fixed xPos, FW_Fixed yPos)
- {fPosition.x = xPos, fPosition.y = yPos;}
-
- FW_TextAlignment GetTextAlignment() const
- {return fTextAlignment;}
- void SetTextAlignment(FW_TextAlignment textAlignment)
- {fTextAlignment = textAlignment;}
-
- void GetBaseLine(FW_CGraphicContext& gc,
- FW_CPoint& start, FW_CPoint& end) const;
-
- //----------------------------------------------------------------------------------------
- // Data Members
- //
- protected:
- FW_CPoint fPosition;
- FW_TextAlignment fTextAlignment;
- };
-
- #endif
-